package com.zhiqianbao.constants;


import android.content.Context;
import android.content.pm.ApplicationInfo;
import android.content.pm.PackageManager;
import android.text.TextUtils;

/**
 * @ClassName: Constants
 * @Description: TODO 常量
 * @author 张岩
 * @date 2015-3-17 上午11:18:38
 */
public class Constants {
	/**
	 * @Fields APK_NAME : 程序apk名称
	 */
	public static final String APK_NAME = "亲亲理财";

	// public static final long TIME_OUT = 1;
	/**
	 * 锁屏需要的常量
	 */
	public static boolean IS_LOCK = false;
	/**
	 * 是否显示log true显示 false关闭
	 */
	public static final boolean IS_SHOW_LOG_CONSTANTS = false;
	/**
	 * 用户登录时返回的TOKEN
	 */
	public static String TOKEN = "";

	/**
	 * 返回JSON数据的分割标志
	 */
	public static final String SPLIT = "::";
	/**
	 * ++++++++++++++++++++++++++++++++++++++++++++++++++++++++渠道名字++++++++++++
	 * +++++++++++++++++++++++++++++
	 */
	// public static final String PC = "website";
	public static String PC = "tencent";
	// public static final String PC = "baidu";
	// public static final String PC = "91";
	// public static final String PC = "xiaomi";
	// public static final String PC = "360";
	// public static final String PC = "huawei";
	/**
	 * 双击超时时间
	 */
	public static final int DOUNLE_CLICKED_TIME = 600;

	public static void setPC(Context context) {
		Constants.PC = getAppMetaData(context, "UMENG_CHANNEL");
	}

	/**
	 * 获取application中指定的meta-data
	 * 
	 * @return 如果没有获取成功(没有对应值，或者异常)，则返回值为空
	 */
	public static String getAppMetaData(Context ctx, String key) {
		if (ctx == null || TextUtils.isEmpty(key)) {
			return "";
		}
		String resultData = "";
		try {
			PackageManager packageManager = ctx.getPackageManager();
			if (packageManager != null) {
				ApplicationInfo applicationInfo = packageManager.getApplicationInfo(ctx.getPackageName(), PackageManager.GET_META_DATA);
				if (applicationInfo != null) {
					if (applicationInfo.metaData != null) {
						resultData = applicationInfo.metaData.getString(key);
						if (resultData != null && !resultData.equals("")) {
							return resultData;
						}
					}
				}
			}
			return "";
		} catch (PackageManager.NameNotFoundException e) {
			e.printStackTrace();
			return "";
		}
	}

	/**
	 * 用户判断登录前从各个页面跳转到设置页面的处理
	 */
	public static int MAIN_ACTIVITY_FLAG = 1;


	/**
	 * StartActivity Handler中sendMessage 跳转到引导页面
	 */
	public static final int GOAPPFLASHACTIVITY = 1;
	/**
	 * StartActivity Handler中sendMessage 跳转到锁屏页面
	 */
	public static final int GOLOCKACTIVITY = 2;
	/**
	 * StartActivity Handler中sendMessage 跳转到main页面
	 */
	public static final int GOMAINACTIVITY = 3;
	/**
	 * StartActivity Handler中sendMessage 自动登录到main页面
	 */
	public static final int AUTOGOMAINACTIVITY = 4;
	/**
	 * @Fields RefreshData : TODO 点击静态的webview页面的刷新按钮
	 */
	public static final int WEBREFRESHDATA = 5;

	/**
	 * 利率表版本号；
	 */
	public static final int LOANVERSON = 1;
	/**
	 * @Fields ANDROID_WIDTH : 屏幕尺寸 宽
	 */
	public static float ANDROID_WIDTH = 480;
	/**
	 * @Fields ANDROID_HEIGHT : 屏幕尺寸 高
	 */
	public static float ANDROID_HEIGHT = 800;
	/**
	 * @Fields LISTITEMNUMS : 搜索结果列表listView显示条数，默认10条
	 */
	public static int LISTITEMNUMS = 10;
	/**
	 * @Fields SCREENSIZE : 屏幕尺寸、英寸，默认4英寸
	 */
	public static double SCREENSIZE = 3.2;

	/**
	 * @Fields 获取图片flag
	 */
	public static final int GET_PIC_FROM_CAMERA = 0x1111;
	public static final int GET_PIC_FROM_PIC_LIB = 0x2222;
	public static final int CROP_SQUAREPICTURE = 0x3333;
	public static final int CROP_RECTANGLEPICTURE = 0x5555;

	/**
	 * 从相机或相册选择身份证正面照片
	 */
	public static final int GET_PIC_FROM_CAMERA_FRONT = 0x6666;
	public static final int GET_PIC_FROM_PIC_LIB_FRONT = 0x7777;
	/**
	 * 从相机或相册选择身份证反面照片
	 */
	public static final int GET_PIC_FROM_CAMERA_BACK = 0x8888;
	public static final int GET_PIC_FROM_PIC_LIB_BACK = 0x9999;
	/**
	 * 回调银行分类
	 */
	public static final int GET_BANKADDRESS = 0x4444;
	/**
	 * app打开次数
	 */
	public static final String SHARED_PREFERENCE_NAME = "qinqinlicai.shared";
	public static final String SHARED_PREFERENCE_NAMEONEW = "qinqinlicai.shared12";
	public static final String SHARED_PREFERENCE_APP_OPEN_COUNT = "APP_OPEN_TIME";
	public static final String SHARED_PREFERENCE_BORROW_MONEY_DAY = "BORROW_MONEY_DAY";
	public static final String SHARED_PREFERENCE_FIRST_ID_AUTHEN = "FIRST_ID_AUTHEN";
	/**
	 * 屏幕尺寸
	 */
	public static final String SHARED_PREFERENCE_SCREEN_HEIGHT = "SHARED_PREFERENCE_SCREEN_HEIGHT";
	public static final String SHARED_PREFERENCE_SCREEN_WIDTH = "SHARED_PREFERENCE_SCREEN_WIDTH";

	
	// Activitys打开次数常量数组
	public static final String[] SHARED_PREFERENCE_ACTIVITYS = new String[] { SHARED_PREFERENCE_APP_OPEN_COUNT };
	// SharedPreference中所存储的程序版本
	public static final String SHARED_PREFERENCE_APP_VERSION = "VERSION";

	public static final String SHARED_JOB = "JOB";
	public static final String SHARED_ZHIMAOPEN = "ZHIMAOROPEN";
	public static final String SHARED_STATTE = "STATETS";
	public static final String SHARED_IDCARD = "idcard";
	public static final String SHARED_DAYA = "data";
	public static final String SHARED_SID = "sid";
	public static final String SHARED_TELECON = "telecon";
	public static final String SHARED_TAOBAO = "taobao";
    public static  final String SHARED_EMEGENCY = "emergency";
	public static final String SHARED_MONEY = "money";
	public static final String SHARED_AUTO = "auto";//记住密码，自动登录

	public static final String SHARED_WEB_ADRESS = "web_adress";//web地址
	public static final String SHARED_API_ADRESS = "api_adress";//api地址

	public static final String SHARED_DATA = "mmdata";
	public static final String SHARED_BANCK = "bank";
	public static final String SHARED_BANCK_NUMBER = "banknuber";

	public static final String SHARED_CITY = "city";
	public static final String SHARED_ADAPTER_RALATION = "adapterlation";
	public static final String SHARED_RALTION = "ralition";
	public static final String SHARED_FATHER = "father";
	public static final String SHARED_PO = "po";
	public static final String SHARED_LIANLIAN = "lianlian";
	public static final String SHARED_LIANLIAN_RESULT = "lianlian_result";
	public static final String SHARRD_TRUE = "true";
	public static final String SHARED_CODEMS = "codems";
	public static final String SHARED_AREDCODE = "areacode";
	public static final String SHARED_ADRESS = "adress";
	public static final String SHARED_NUMBER = "jobnumber";
	public static final String SHARED_PROVINCE = "province";
	public static final String SHARED_AREA = "area";
	public static final String SHARED_CITY1 = "city1";
	public static final String SHARED_COMPANEY = "company";
	public static final String SHARED_DATAPAY = "datapay";
	public static final String SHARED_BANCNAME = "banckname";
	public static final String SHARED_ID = "id";
	public static final String SHARED_ZHIMA = "zhima";
	public static final String SHARED_NAME = "name";
	public static final String SHARED_PHONE_NUMEBR = "phone2";

	// SharedPreference中所存储的用户手机号
	public static final String SHARED_PERFERENCE_TEL_NUM = "tel_num";
	public static final String SHARED_IDCARD_NUMBER = "idcarnumber";
	public static final String SHARED_PERFERENCE_CARD_NO = "Cardno";
	public static final String SHARED_PERFERENCE_Bank = "Bank";
	public static final String SHARED_PERFERENCE_MINID = "minid";
	public static final String SHARED_PERFERENCE_MAXID = "maxid";

	// 实名认证
	public static final String SHARED_PERFERENCE_VERTIFY = "RENZHENG";
	/**
	 * SharedPreference中所存储的用户姓名
	 */
	public static final String SHARED_PERFERENCE_USERNAME = "username";
	/**
	 * SharedPreference中所存储的rememberToken
	 */
	public static final String SHARED_PERFERENCE_REMEMBER_TOKEN = "remember_token";
	/**
	 * hasnewversion
	 */
	public static final String SHARED_PERFERENCE_HASNEWVERSION = "hasnewversion";
	/**
	 * 手势密码
	 */
	public static final String SHARED_PERFERENCE_GESTUREPASSWORD = "gesturepassword";
	/**
	 * 手势密码开关状态值
	 */
	public static final String SHARED_PERFERENCE_GESTURESWITCH = "gestureswitch";
	/**
	 * 初始设置手势密码后,只打开手势密码开关状态 ,不跳转验证手势密码页面
	 */
	public static final String SHARED_PERFERENCE_ISFIRSTGESTURE = "isFirstGesture";
	/**
	 * 保存最大值
	 */
	public static final String SHARED_PERFERENCE_ISMAXID = "isMaxid";
	/**
	 * 更换默认提现的银行卡
	 */
	public static final String SHARED_PERFERENCE_ISCHANGEBANKCARD = "isChangeBankCard";
	/**
	 * 更换默认提现的银行卡(号)
	 */
	public static final String SHARED_PERFERENCE_ISCHANGEBANKCARDNO = "isChangeBankCardNo";
	/**
	 * 保存用户信息
	 */
	public static final String SHARED_PERFERENCE_USERINFO = "userinfo";
	/**
	 * 前台activity状态值
	 */
	public static final String SHARED_PERFERENCE_ISFOREGROUND_KEY = "isforeground";
	public static final String SHARED_FORCE = "force";
	public static final String SHARED_RONGBAOPAYSTATE = "rongbao";
	public static final String SHARED_ALIPAYSTATE = "aliPayStatus";

	public static  final String SHARED_TOKEN = "token";
	public static final String SHARED_UserID = "id";

	public static final String SHARED_UID = "id";

	public static final String SHARED_PHONE = "phone";

	public static final String SAVE_USERNAME = "username";

	public static final String SAVE_USER_ID = "userid";

	public static final String SAVE_PASSWORD = "password";

    public static final String SAVE_SATTE = "true";
	/**
	 * 1/17 保存银行卡列表提示信息
	 */
	public static final String SHARED_BANKLIST_MESSAGE = "SHARED_BANKLIST_MESSAGE";
	/**
	 * 1/17 保存银行卡列表应用版本
	 */
	public static final String SHARED_BANKLIST_VERSION = "SHARED_BANKLIST_VERSION";
	/**
	 * 身份未验证
	 */
	public static final String CITIZEN_VERIFY_ERROR = "CITIZEN_VERIFY_ERROR";
	/**
	 * 持证拍照信息未通过
	 */
	public static final String CITIZEN_PHOTO_ERROR = "CITIZEN_PHOTO_ERROR";
	/**
	 * 银行卡信息错误
	 */
	public static final String BANKCARD_ERROR = "BANKCARD_ERROR";
	/**
	 * 系统判断的其他错误，如已有申请在审核中，有借款未还等
	 */
	public static final String REJECT_ERROR = "REJECT_ERROR";
	/**
	 * 申请确认信息概述，HTML5标准的格式内容
	 */
	public static final String SUMMARY = "summary";
	/**
	 * 协议内容，HTML5标准的格式内容
	 */
	public static final String CONTRACT = "contract";
	/**
	 * 是否成功描述；
	 */
	public static final String RET = "ret";
	/**
	 * Login——>Main 中传递信息
	 */
	public static final String LOGIN_RET_MSG = "login_ret_msg";
	/**
	 * 查看大图URL
	 */
	public static final String BIGPICURL = "PicURL";
	/**
	 * 添加附件传递实体类名称
	 */
	public static final String ATTACHMENT = "Attachment";
	/**
	 * 申请中、应还款、已还款状态名；
	 */
	public static final String STATE = "state";
	/**
	 * 申请中状态值；0
	 */
	public static final String STATE_APPLYING = "0";
	/**
	 * 应还款记录状态值；1
	 */
	public static final String STATE_SHOULDLRETURN = "1";
	/**
	 * 已还款记录状态值；2
	 */
	public static final String STATE_RETURNED = "2";
	/**
	 * 最低单笔投资金额
	 */
	public static final int MINMONEY = 50;
	/**
	 * 最高单笔投资金额
	 */
	public static final int MAXMONEY = 5000;
	/**
	 * 超时时间
	 */
	public static final int TIME_OUT = 10;
	/**
	 * HEART_BEAT_DATA_TYPE Heart_beat中的数据类型 1=联系人
	 */
	public static final String HEART_BEAT_DATA_TYPE_CONTACTS = "1";
	/**
	 * HEART_BEAT_DATA_TYPE Heart_beat中的数据类型 2=非系统应用
	 */
	public static final String HEART_BEAT_DATA_TYPE_APP_LIST = "2";
	/**
	 * 控制popupwindow红色圆点的显示与隐藏
	 */
	public static int POPUPWINDOW_RED_DOT = 0;
	/**
	 * 控制popupwindow中的item应用推荐红色圆点的显示与隐藏
	 */
	public static int POPUPWINDOW_APP_RED_DOT = 0;
	/**
	 * 控制popupwindow中的item应用推荐红色圆点的显示与隐藏的Flag;0=不显示，1=显示
	 */
	public static int POPUPWINDOW_APP_RED_DOT_FLAG = 0;
	/**
	 * 控制popupwindow中的item版本更新红色圆点的显示与隐藏
	 */
	public static int POPUPWINDOW_UPDATE_VERSION_RED_DOT = 0;
	/**
	 * 控制popupwindow中的item版本更新红色圆点显示与隐藏的flag;0=不显示，1=显示
	 */
	public static int POPUPWINDOW_UPDATE_VERSION_RED_DOT_FLAG = 0;
	// */ 手势密码点的状态
	public static final int POINT_STATE_NORMAL = 0; // 正常状态

	public static final int POINT_STATE_SELECTED = 1; // 按下状态

	public static final int POINT_STATE_WRONG = 2; // 错误状态

	public static final String QQLC_SPIK_COMMON_WEBVIEW_URL = null;

	// */

	public static class Config {
		public static final boolean DEVELOPER_MODE = false;
	}

	/**
	 * @Fields CHECK_CODE : TODO
	 */
	public static final int CHECK_CODE = 0x1;
	/**
	 * @Fields LONG_DURATION : TODO语音播报最长时间间隔
	 */
	public static final int LONG_DURATION = 5000;
	/**
	 * @Fields SHORT_DURATION : TODO语音播报最短时间间隔
	 */
	public static final int SHORT_DURATION = 1200;
	/**
	 * 地理经度
	 */
	public static double longitude = 0.0;
	/**
	 * 地理纬度
	 */
	public static double latitude = 0.0;
	// 对于不同的识别应用，定义不同的请求码
	public static final int MY_SCAN_REQUEST_CODE_BANK = 101; // 银行卡识别请求码
	public static final int MY_SCAN_REQUEST_CODE_ID = 102; // 身份证识别请求码
	public static final int PHOTO_BANK = 0x1024;
	public static final int PHOTO_ID = 0x1025;

	public static int LISTVIEWITEMPOSITION = 0;

}